home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / graf.h < prev    next >
C/C++ Source or Header  |  1994-11-19  |  2KB  |  51 lines

  1. //    Class for drawing X-Y dependences on screen.
  2.  
  3. #ifndef __GRAF_H_
  4. #define __GRAF_H_
  5.  
  6. #include "drawtool.h"
  7. #include "khbgi.h"
  8.  
  9. /*    There are few types of graphics. Line graf could be used for
  10.     drawing splines (no markers). Marker graf looks nice for the set
  11.     of few (up to 20 - 40) points. Combined graf is the combination of
  12.     line and marker grafs (data with spline). Bar and 3 dimensional bar
  13.     presents data as bars drawn from 0(Y) to y(Y). Stacked bar graf
  14.     draws 3-d bars not from zero, but from the top of previous bar.
  15. */
  16.  
  17. enum { NO_GRAF, LINE_GRAF, MARKER_GRAF, COMBINED_GRAF, BAR_GRAF,
  18.        BAR_3D_GRAF, STACKED_BAR_GRAF };
  19.  
  20. enum { NONE, BAR, CIRCLE, TRIANGLE, STAR5, STAR6, CROSS, X_CROSS,
  21.        DIAMOND, TRIANGLE2, BAR2, CIRCLE2 };
  22.  
  23.  
  24. struct Graf
  25.     {
  26.     int marker_type;
  27.     int line_type;
  28.     int attr;           // Color
  29.     int bak;            // Background
  30.     int size;           // Size of marker
  31.     int fill;           // Fill pattern for bar graf family. In 1.x
  32.                 // version we use BGI - not VBGI graphics.
  33.  
  34.     Graf(int m = 0, int l = 1, int a = 0, int b = 15, int s = 4, int f=1)
  35.         { marker_type = m; line_type = l;  attr = a; bak = b; size = s;
  36.           fill = f; }
  37.     void set_type(int m, int l, int a, int b, int s, int f)
  38.         { marker_type = m; line_type = l; attr = a; bak = b; size = s;
  39.           fill = f; }
  40. // X and Y contains integer (screen) coordinates, which was recalculated
  41. // from double data. Data are ordered on X axe.
  42.     void show(int* x, int* y, int number_of_points,
  43.         int x_left_of_graf, int y_left_of_graf, int num_in_container = 0);
  44.     void set_type(int m_t, int l_t)
  45.         { line_type = l_t; marker_type = m_t; }
  46.     void set_param(int a, int b, int s, int f)
  47.         { attr = a; bak = b; size = s; fill = f; }
  48.     void show_marker(int type, loc pos, int color, int size = 4);
  49.     };
  50.  
  51. #endif __GRAF_H_